package Feb_10.Task;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Objects;
import java.util.Properties;
import java.util.Scanner;

public class Task4 {
    public static void main(String[] args) {
        Properties properties = new Properties();
        try (InputStream inputStream = new FileInputStream(new File("E:/Properties.txt"))) {
            properties.load(inputStream);
            String user = properties.getProperty("user");
            String password =properties.getProperty("password");
            Scanner scanner = new Scanner(System.in);
            System.out.print("输入用户名：");
            String inputuser = scanner.nextLine();
            System.out.print("输入密码：");
            String inputpassword = scanner.nextLine();
            if (Objects.equals(inputuser, user) & Objects.equals(inputpassword, password)){
                System.out.println("登录成功！");
            }else {
                System.out.println("用户名或密码错误！");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
